from django.conf.urls.defaults import *
from django.views.generic import list_detail
from django.views.generic.simple import direct_to_template
from pentester.hosts.models import Host, Configuration
from pentester.worker.models import Logs, Session
from pentester.hosts.views import createMenu

lista_hostow = {
                'queryset' : Host.objects.all(),
                'template_name' : 'host_list.html',
}
logs_info = {
             'queryset' : Logs.objects.all(),
             'template_name' : 'logs_list.html',
             'allow_empty' : True,
             'extra_context' : { 'menuitems' : createMenu('logs') },
}
sessions_info = {
                 'queryset' : map(lambda x: x.rhost, Session.objects.all()),
                 'template_name' : 'sess_list.html',
                 'allow_empty' : True,
                 'extra_context' : {'menuitems' : createMenu('results')}
}
urlpatterns = patterns('',
     (r'^hosty/$',  list_detail.object_list, lista_hostow),
     (r'^logs/$', list_detail.object_list, logs_info),
     (r'^logs/clear/$', 'pentester.worker.views.clearlogs'),
     #(r'^results/$', list_detail.object_list, sessions_info),
     (r'results/$', 'pentester.worker.views.results'),
     (r'^deletehost/(?P<hostid>\d+)/$', 'pentester.hosts.views.deletehost'),
     (r'^if/$', 'pentester.hosts.views.ifaces'),
     (r'^if/(?P<iface>\w+)/$', 'pentester.hosts.views.iface_detail'),
     (r'^static/(?P<path>.*)$', 'django.views.static.serve', { 'document_root':'/home/skrobul/workspace/inzynierka-www/pentester/static/'}),
     (r'^services/update/', 'pentester.hosts.views.servupdate'),
     (r'^services/add/', 'pentester.hosts.views.addport'),
     (r'^services/(?P<hostid>.*)', 'pentester.hosts.views.services'),
     (r'^config/$', 'pentester.hosts.views.configuration'),
     (r'^scan/$', 'pentester.worker.views.scan'),
     (r'^scan/net/$', 'pentester.worker.views.netscan'),
     (r'^exploit/$', 'pentester.worker.views.exploit'),
     (r'^$', 'pentester.hosts.views.index'),
)
